package com.blb.controller;


import com.blb.pojo.IndustryManagement;
import com.blb.service.CooperativePartnerService;
import com.blb.util.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin(origins = "*")
@Api(tags = "合作伙伴")
public class CooperativePartnerController {
    @Autowired
    private CooperativePartnerService cooperativePartnerService;


    @ApiOperation(value = "分页查看合作信息")
    @GetMapping("selectAllLogos")
    private Page selectAllLogo(@ApiParam(name = "nowPage", value = "当前页", required = true) @RequestParam(value = "nowPage", defaultValue = "1") Integer nowPage,
                               @ApiParam(name = "pageSize", value = "每页数量", required = true) @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize) {
        return cooperativePartnerService.selectAllLoge(nowPage, pageSize);
    }

    @ApiOperation(value = "根据id查看行业、所有公司logo和伙伴名称")
    @GetMapping("selectCPAndIM/{id}")
    private Map selectCPAndIM(@ApiParam(name = "id", value = "合作伙伴id", required = true) @PathVariable int id) {
        Map map = cooperativePartnerService.selectCPAndIM(id);
        return map;
    }

    @ApiOperation(value = "获取行业图标")
    @GetMapping("selectIcons")
    private List selectIcon() {
        List<IndustryManagement> industryManagements = cooperativePartnerService.selectIndustryIcon();
        return industryManagements;
    }


}
